<template>
	<view class="search">
		<comHead :title="'搜索'" :isLeft="true" :isRight="false"></comHead>
		<view class="content">
			<view class="searchBox">
				<input v-model="ipt" @input="onInput" type="text" :placeholder="'请输入剧名搜索'"/>
				<image src="https://siha.vxmeng.com/static/privacy/msearch.png" mode="widthFix"></image>
			</view>
			
			<template v-if="!isSearch">
				<view class="hot">
					<view class="tit">
						<image src="https://siha.vxmeng.com/static/more/hot.png" mode="widthFix"></image>
						<text>大家都在搜</text>
					</view>
					<view class="hotList">
						<view class="hot-item" v-for="(item, index) in 10">
							<view class="rank">{{index+1}}</view>
							<text>校园风云录</text>
						</view>
					</view>
				</view>
				
				<view class="recommend">
					<view class="tit">
						<image src="https://siha.vxmeng.com/static/more/hot.png" mode="widthFix"></image>
						<text>推荐</text>
					</view>
					<view class="recommendList">
						<view class="recommend-item" v-for="item in 6" @click="toWatch(item)">
							<view class="img">
								<image src="https://siha.vxmeng.com/static/shu.jpg" mode="aspectFill"></image>
							</view>
							<view class="info">
								<view class="hot">热播</view>
								<text>这是剧名</text>
							</view>
						</view>
					</view>
				</view>
			</template>
			
			<view class="searchList" v-else>
				<view class="item" v-for="item in 6">
					<view class="img">
						<image src="https://siha.vxmeng.com/static/shu.jpg" mode="aspectFill"></image>
					</view>
					<view class="info">
						<view class="tit">这是剧名</view>
						<view class="intro">
							前世她是豪门千金，因家族纷争和爱情背叛，被陷害身亡。今世重生回到二十岁...
						</view>
						<view class="other">观看至第{{4}}集 / 共{{93}}集</view>
						<view class="btns">
							<view class="btn">
								<image src="https://siha.vxmeng.com/static/playlet/zj.png" mode="widthFix"></image>
								<text>追剧</text>
							</view>
							<view class="btn">
								<image src="https://siha.vxmeng.com/static/playlet/no-sc.png" mode="widthFix"></image>
								<text>收藏</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isSearch: false,
				ipt: '',
				hotList: [],
				recommendList: [],
				searchList: [],
			}
		},
		methods: {
			onInput(){
				this.isSearch = this.ipt != ''
				console.log(this.isSearch);
			}
		}
	}
</script>

<style lang="less" scoped>
.search{
	width: 100vw;
	height: 100vh;
	
	.content{
		padding: 0 30rpx;
		
		.searchBox{
			width: 100%;
			height: 80rpx;
			background: linear-gradient(97deg, #2A2832 0%, rgba(30, 36, 44, 0.65) 100%);
			display: flex;
			align-items: center;
			border-radius: 40rpx;
			padding: 0 16rpx 0 40rpx;
			input{
				flex: 1;
				height: 100%;
				color: #fff;
			}
			image{
				width: 40rpx;
				padding: 20rpx;
			}
		}
		
		.hot{
			color: #fff;
			.tit{
				display: flex;
				align-items: center;
				margin: 40rpx 0;
				font-size: 28rpx;
				font-weight: 600;
				background: linear-gradient(131deg, #BBDFFA 10%, #9ED1F8 31%, #5855E8 109%);
				-webkit-background-clip: text;
				-webkit-text-fill-color: transparent;
				image{
					width: 40rpx;
					margin-right: 10rpx;
				}
			}
			.hotList{
				display: flex;
				flex-wrap: wrap;
				flex-direction: column;
				height: 300rpx;
				
				.hot-item{
					width: 40%;
					margin-right: 12%;
					display: flex;
					align-items: center;
					margin-bottom: 22rpx;
					font-size: 28rpx;
					.rank{
						width: 36rpx;
						height: 36rpx;
						text-align: center;
						line-height: 36rpx;
						margin-right: 20rpx;
						border-radius: 4rpx;
						background: linear-gradient(137deg, #2A2832 0%, rgba(30, 36, 44, 0.65) 103%);
					}
					&:nth-child(1){
						.rank{
							background: #FF5F3D;
						}
					}
					&:nth-child(2){
						.rank{
							background: #FF9500;
						}
					}
					&:nth-child(3){
						.rank{
							background: #FFCA36;
						}
					}
				}
			}
		}
		
		.recommend{
			color: #fff;
			.tit{
				display: flex;
				align-items: center;
				margin: 40rpx 0;
				font-size: 28rpx;
				font-weight: 600;
				background: linear-gradient(131deg, #BBDFFA 10%, #9ED1F8 31%, #5855E8 109%);
				-webkit-background-clip: text;
				-webkit-text-fill-color: transparent;
				image{
					width: 40rpx;
					margin-right: 10rpx;
				}
			}
			
			.recommendList{
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;
				
				.recommend-item{
					width: 220rpx;
					height: 320rpx;
					margin-bottom: 22rpx;
					font-size: 28rpx;
					border-radius: 16rpx;
					overflow: hidden;
					background-color: #22252E;
					.img{
						height: 272rpx;
						width: 100%;
						image{
							width: 100%;
							height: 100%;
						}
					}
					.info{
						height: 48rpx;
						display: flex;
						align-items: center;
						box-shadow: 0px 4rpx 4rpx 12rpx rgba(0, 0, 0, 0.2);
						view{
							font-size: 16rpx;
							width: 56rpx;
							height: 30rpx;
							line-height: 30rpx;
							text-align: center;
							margin: 0 10rpx;
							border-radius: 15rpx;
							background: linear-gradient(287deg, #62B6FC 0%, #5F58FD 77%, #5F58FD 98%);
						}
						text{
							font-size: 18rpx;
						}
					}
				}
			}
		}
		
		.searchList{
			width: 100%;
			.item{
				height: 280rpx;
				margin-top: 20rpx;
				color: #fff;
				display: flex;
				background-color: #171726;
				.img{
					width: 200rpx;
					height: 280rpx;
					margin-right: 20rpx;
					image{
						width: 100%;
						height: 100%;
					}
				}
				.info{
					flex: 1;
					.tit{
						font-size: 36rpx;
					}
					.intro{
						font-size: 24rpx;
						color: #999999;
						margin-top: 20rpx;
					}
					.other{
						font-size: 24rpx;
						margin-top: 20rpx;
					}
					.btns{
						margin-top: 40rpx;
						display: flex;
						.btn{
							width: 144rpx;
							height: 56rpx;
							margin-right: 24rpx;
							border-radius: 10rpx;
							background: linear-gradient(270deg, #5F58FD 0%, #62B6FC 100%);
							display: flex;
							justify-content: center;
							align-items: center;
							image{
								width: 24rpx;
								margin-right: 10rpx;
							}
						}
					}
				}
			}
		}
	}
}
</style>
